package com.springboot.annotation.conditional.condition;


import org.springframework.context.annotation.Condition;
import org.springframework.context.annotation.ConditionContext;
import org.springframework.core.env.Environment;
import org.springframework.core.type.AnnotatedTypeMetadata;

/**
 * @Author: lzx
 * @Data: 2021/05/08/13:57
 * @Description：
 */
public class LinuxCondition implements Condition {
    @Override
    public boolean matches(ConditionContext context, AnnotatedTypeMetadata metadata) {
        Environment environment = context.getEnvironment();
        String linux = environment.getProperty("os.name");
        if (linux.contains("Linux")) {
            return true;
        }
        return false;
    }
}
